int BinaryTreeSize(struct TreeNode* root)
{
	return root == NULL ? 0 : BinaryTreeSize(root->left) + BinaryTreeSize(root->right) + 1;
}

void _postorderTraversal(struct TreeNode* root, int* arr, int* i)
{
    if(root == NULL)
    {
        return;
    }
    _postorderTraversal(root->left, arr, i);
    _postorderTraversal(root->right, arr, i);
    arr[(*i)++] = root->val;
}

int* postorderTraversal(struct TreeNode* root, int* returnSize) 
{
    *returnSize = BinaryTreeSize(root);
    int* arr = (int*)malloc(*returnSize * sizeof(int));
    int i = 0;
    _postorderTraversal(root, arr, &i);
    return arr;
}